/*
 * (C)2012 Exlu Corporation. All rights reserved.
 * 文件名 : cn.exlu.wea.io.directory.LpFilenameFilter.java
 * 注意事項   :
 */
package cn.exlu.wea.io.directory;

import java.io.File;
import java.io.FileFilter;

import cn.exlu.wea.field.validator.LpValidatorSpecificUtil;

/**
 * @author Mark 
 * @version 1.0.0
 * @date 2014-5-11
 * @fileName LpFilenameFilter.java
 */
public class LpFileNameFilter implements FileFilter{
    private String fuzzyName;
    public LpFileNameFilter(String fuzzyName){
        this.fuzzyName=fuzzyName;
    }

    /* (non-Javadoc)
     * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
     */
    @Override
    public boolean accept(File file) {
        
        if(!file.isFile()){
            return false;
        }
        
        return LpValidatorSpecificUtil.isFuzzyMatch(fuzzyName, file.getName());

    }

}
